//
//  PlaceholderTextView.m
//  DogeLegs
//
//  Created by 宋华 on 2017/8/23.
//  Copyright © 2017年 宋华. All rights reserved.
//

#import "PlaceholderTextView.h"

@interface PlaceholderTextView () {

}

@property (nonatomic,strong)UILabel *placeholderLabel;

@end

@implementation PlaceholderTextView


- (void)awakeFromNib {
    [super awakeFromNib];
    [self createSubviews];
}

+ (PlaceholderTextView *)plhTextView;
{
    PlaceholderTextView * textview = [[self alloc] init];
    
    [textview createSubviews];
    return textview;
}


- (void)createSubviews {
    self.returnKeyType = UIReturnKeyDone;
    UILabel *label = [[UILabel alloc] init];
    label.textAlignment = NSTextAlignmentLeft;
    label.font = [UIFont systemFontOfSize:13.0];
    label.numberOfLines = 1;
    label.textColor = globeSiCunColorGray;
    label.backgroundColor = [UIColor clearColor];
    self.placeholderLabel = label;
    [self addSubview:label];
    WeakSelf(ws);
    [self.placeholderLabel  mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(@200);
        make.left.mas_equalTo(ws.mas_left).offset(5);
        make.centerY.equalTo(ws.mas_centerY);
    }];
}

- (void)setPlaceholder:(NSString *)placeholder {
    if (_placeholder != placeholder) {
        _placeholder = placeholder;
        self.placeholderLabel.text = placeholder;
    }
}


@end
